package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.RejectedProduct;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RejectedProductDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "退货的产品id")
    private Integer productId;

    @ApiModelProperty(value = "退货主表id")
    private Integer rejectedId;

    @ApiModelProperty(value = "退货数量")
    private Integer recededNum;

    @ApiModelProperty(value = "已处理的数量")
    private Integer handleNum;

    @ApiModelProperty(value = "增在处理的数量")
    private Integer processingNum;

    @ApiModelProperty(value = "送货数量")
    private Integer deliverNum;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "规格型号")
    private String specification;

    @ApiModelProperty(value = "计量单位")
    private String unitName;

    @ApiModelProperty(value = "材质")
    private String material;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "产品名称")
    private String name;

    @ApiModelProperty(value = "合同数量")
    private Integer contractNum;


    public RejectedProductDTO() {}

    public RejectedProductDTO(RejectedProduct entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static RejectedProductDTO convert(RejectedProduct entity) {
        return new RejectedProductDTO(entity);
    }

    public static List<RejectedProductDTO> convertList(List<RejectedProduct> list) {
        List<RejectedProductDTO> resultList = new ArrayList<>();
        for (RejectedProduct entity : list) {
            resultList.add(new RejectedProductDTO(entity));
        }
        return resultList;
    }}
